﻿using System;
using System.Drawing;
using System.Windows.Forms;

namespace Rename.UC.组合
{
    public partial class Uc扩展名 : UserControl
    {
        public Uc扩展名()
        {
            InitializeComponent();
        }

        private void Init()
        {
            SetVisible(false);
            SetEnable(false);

            lbl新扩展名.Location = new Point(lbl查找内容.Location.X, lbl查找内容.Location.Y + 10);
            txt新扩展名.Location = new Point(txt查找内容.Location.X, txt查找内容.Location.Y + 10);
        }

        private void SetVisible(bool isVisible)
        {
            lbl查找内容.Visible = isVisible;
            lbl替换内容.Visible = isVisible;
            txt查找内容.Visible = isVisible;
            txt替换内容.Visible = isVisible;

            lbl新扩展名.Visible=!isVisible;
            txt新扩展名.Visible=!isVisible;

        }
        private void SetEnable(bool isEnable)
        {
            lbl类型.Enabled=isEnable;
            rad自定义.Enabled = isEnable;
            rad替换.Enabled=isEnable;
            lbl查找内容.Enabled = isEnable;
            lbl替换内容.Enabled = isEnable;
            txt查找内容.Enabled= isEnable;
            txt替换内容.Enabled = isEnable;
            lbl新扩展名.Enabled = isEnable;
            txt新扩展名.Enabled =isEnable;
        }


        private void Uc扩展名_Load(object sender, EventArgs e)
        {
            Init();
        }

        private void chk扩展名_CheckedChanged(object sender, EventArgs e)
        {
            SetEnable(chk扩展名.Checked);
        }

        private void rad自定义_CheckedChanged(object sender, EventArgs e)
        {
            lbl查找内容.Visible = false;
            lbl替换内容.Visible = false;
            txt查找内容.Visible = false;
            txt替换内容.Visible = false;

            lbl新扩展名.Visible = true;
            txt新扩展名.Visible = true;
        }

        private void rad替换_CheckedChanged(object sender, EventArgs e)
        {
            lbl查找内容.Visible = true;
            lbl替换内容.Visible = true;
            txt查找内容.Visible = true;
            txt替换内容.Visible = true;

            lbl新扩展名.Visible = false;
            txt新扩展名.Visible = false;
        }
    }
}
